package com.engine.budget.enums;

public enum Instruction {
    ZX("ZX","执行"),
    SFZX("SFZX","释放执行"),
    ZY("ZY","占用"),
    SFZY("SFZY","释放占用"),
    SFZYQZX("SFZYQZX","释放占用且执行"),
    SFZXQZY("SFZXQZY","释放执行且占用"),
    XMZX("XMZX","仅项目执行"),
    XMSFZX("XMSFZX","仅项目释放执行"),
    XMZY("XMZY","仅项目占用"),
    XMSFZY("XMSFZY","仅项目释放占用"),
    XMSFZYQZX("XMSFZYQZX","仅项目释放占用且执行"),
    XMSFZXQZY("XMSFZXQZY","仅项目释放执行且占用"),

    JZX("JZX","仅执行"),

    IA("IA","查询年度剩余可用预算百分比");

    private String value;
    private String description;

    Instruction(String value, String description) {
        this.value = value;
        this.description = description;
    }

    public static Instruction getInstance(String value) {
        for (Instruction instruction : Instruction.values()) {
            if (value.equals(instruction.value)) {
                return instruction;
            }
        }
        return null;
    }

    public static boolean hasInstance(String value) {
        for (Instruction instruction : Instruction.values()) {
            if (value.equals(instruction.value)) {
                return true;
            }
        }
        return false;
    }

    public String getDescription() {
        return description;
    }

    public String getValue() {
        return value;
    }

    public boolean equals(Instruction instruction) {
        return this.value.equals(instruction.value);
    }

    public boolean equals(String value) {
        return this.value.equals(value);
    }

}
